/**
 * @Author: XiaoDan
 * @Date: 2023/12/23
 * @Description:
 */
package flc.ast.adapter;

import android.graphics.Color;
import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder;

import flc.ast.R;
import flc.ast.databinding.ItemUnitTabBinding;
import stark.common.basic.adapter.BaseDBRVAdapter;

public class UnitTabAdapter extends BaseDBRVAdapter<String, ItemUnitTabBinding> {
    public int selIndex;

    public UnitTabAdapter() {
        super(R.layout.item_unit_tab, 0);
    }

    @Override
    protected void convert(@NonNull BaseDataBindingHolder<ItemUnitTabBinding> holder, String item) {
        super.convert(holder, item);
        ItemUnitTabBinding binding = holder.getDataBinding();
        if (holder.getAdapterPosition() == selIndex) {
            binding.ivSel.setVisibility(View.VISIBLE);
            binding.tvTitle.setTextColor(Color.parseColor("#000000"));
            binding.tvTitle.setTextSize(18);
        } else {
            binding.ivSel.setVisibility(View.INVISIBLE);
            binding.tvTitle.setTextColor(Color.parseColor("#A8A8A8"));
            binding.tvTitle.setTextSize(15);
        }
        binding.tvTitle.setText(item);
    }
}
